package com.zqh.app.manager.impl;

import com.zqh.app.dao.DeviceMapper;
import com.zqh.app.entity.Device;
import com.zqh.app.manager.AppDeviceManager;
import com.zqh.common.entity.Page;
import com.zqh.common.entity.Query;
import com.zqh.common.entity.R;
import com.zqh.common.utils.CommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("AppDeviceManager")
public class AppaDeviceManagerImpl implements AppDeviceManager {

    @Autowired
    DeviceMapper deviceMapper;


    @Override
    public List<Device> getDevices(Page<Device> page, Query query) {
        return deviceMapper.listForPage(page ,query);
    }

    @Override
    public R delDevice(String groupId) {
        int count = deviceMapper.remove(groupId);
        return CommonUtils.msg(count);
    }
}
